package com.二叉树;

//二叉树节点声明
class TreeNode{
      int val;
      TreeNode left;
      TreeNode right;
      TreeNode() {}
      TreeNode(int val) { this.val = val; }
      TreeNode(int val, TreeNode left, TreeNode right) {
          this.val = val;
          this.left = left;
          this.right = right;
}



}

class Solution{

    //前序遍历
    public void preOrder(TreeNode node){
        if(node==null) return;
        System.out.println(node.val);
        preOrder(node.left);
        preOrder(node.right);
    }
    //中序遍历
    public void inOrder(TreeNode node){
        if(node==null) return;
        inOrder(node.left);
        System.out.println(node.val);
        inOrder(node.right);
    }
    //后序遍历
    public void postOrder(TreeNode node){
        if(node==null) return;
        postOrder(node.left);
        postOrder(node.right);
        System.out.println(node.val);
    }

}
public class 递归遍历 {
    public static void main(String[] args) {
        System.out.println();
    }
}
